import pandas as pd

order = {'001':'面包,黄油,尿布,啤酒', '002':'面包,黄油,咖啡,尿布,啤酒,鸡蛋', '003':'面包,黄油,鲑鱼,鸡'}
data_set = []
id_set = []
shopping = {}
for key in order:
    item = order[key].split(',')
    id_set.append(key)
    data_set.append(item)
shopping['id'] = id_set
shopping['basker'] = data_set
data = pd.DataFrame(shopping)
data_basker = data['basker'].str.join(',')
data_basker = data_basker.str.get_dummies(',')
data_id = data.drop('basker', axis=1)
new_data = data_id.join(data_basker)
print(new_data)